package com.wc.alorithm_luogu.P1308;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/4/23 11:32
 * @description https://www.luogu.com.cn/problem/P1308
 * 统计单词数
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String word = sc.nextLine().toLowerCase();
        String paper = sc.nextLine().toLowerCase();


        int sum = 0;
        int first = -1;
        String[] str = paper.split(" ");

        for (int i = 0; i < str.length; i++) {
            if (word.equals(str[i])) {
                sum++;
            }
        }

        if (sum == 0) {
            System.out.println(first);
            return;
        }

        if (word.equals(str[0])) {
            first = 0;
        } else if (word.equals(str[str.length - 1])) {
            first = paper.length() - word.length();
        } else {
            first = paper.indexOf(" " + word + " ") + 1;
        }

        System.out.println(sum + " " + first);
    }
}
